<template>
  <div class="app-container">
    <div class="sao">
      <div>
        <strong style="color: green; font-size: 60px">支付成功！</strong>
      </div>
      <div style="margin:10px 0 0 40px">即将在<span style="color:red">{{ count }}</span>s后跳转至首页...</div>
    </div>
  </div>
</template>

<script>
export default {
    name:'Paysuccess',
    data() {
        return {
            count:'',//倒计时
        }
    },
    created() {
        this.threeGo()
    },
    methods: {
  //3秒后进入跳转页面
    threeGo(){
		const TIME_COUNT = 3;
		if(!this.timer){
			this.count = TIME_COUNT;
			this.show = false;
			this.timer = setInterval(()=>{
			if(this.count > 0 && this.count <= TIME_COUNT){
				this.count--;
			}else{
				this.show = true;
				clearInterval(this.timer);
				this.timer = null;
				//跳转的页面写在此处
				this.$router.push({path: '/'});
        window.opener = null;
        window.open('/', "_top").close();
			}
		  },1000)
		}
    },
    }
}
</script>

<style scoped>
.sao {
  position: absolute;
  top: 50%;
  left: 50%;
  margin: -150px 0 0 -160px;
  width: 400px;
  height: 300px;
}
</style>
